<script type="text/javascript">
<!--
<?php 
$all = count($model->objects);
$addresses = $images = $names = $urls = $prices = '';
foreach ($model->objects as $key => $object) :
	$address		= $object->country->name.', '.$object->city->name.', '.$object->street.' '.$object->house .'/'.$object->apartment;
	// $image			= '/upload/images/'.$object->user_id.'/'.$object->id.'/'.$object->mainImage->name;
	$image			= $object->mainImage ? 
						$this->material_image_src($object->mainImage->id, $object->mainImage->name, '205', 'images/'.$object->user_id.'/'.$object->id) : 
							$this->material_image_src(0, 'noimage.gif', '205', '');
	$url 			= Yii::app()->createUrl('cataloge/view', array('id'=>$object->id));
	$addresses 		.=  $key+1!=$all ? '"'.$address.'", ' : '"'.$address.'"';
	$images 		.=  $key+1!=$all ? '"'.$image.'", ' : '"'.$image.'"';
	$names 			.=  $key+1!=$all ? '"'.$object->name.'", ' : '"'.$object->name.'"';
	$urls 			.=  $key+1!=$all ? '"'.$url.'", ' : '"'.$url.'"';
	$prices 			.=  $key+1!=$all ? '"'.$object->price.'", ' : '"'.$object->price.'"';
endforeach;
?>
window.addresses = [<?php echo $addresses;?>];
window.images = [<?php echo $images;?>];
window.names = [<?php echo $names;?>];
window.urls = [<?php echo $urls;?>];
window.prices = [<?php echo $prices;?>];
//-->
</script>

<div class="cl">
	<div class="content_holder fl">
		<div id="content">
			<div class="block_holder br5">
				<div class="tab_holder">
					<div class=" cl">
						<?php if($model->about) : ?>
							<p><?php echo CHtml::encode($model->about); ?></p>
						<?php endif; ?>

						<p>School: London School of Economics</p>
						<p>Work: Airbnb</p>
						<p>Groups: London School of Economics, Specimen, LA main gauche de Thierry HENRY, Les phrases qu'on peut entendre qu'au niveau District (foot)</p>
						<p>Languages: English, Français</p>
					</div>
				</div>
			</div>
			<!-- My Objects -->
			<?php if(count($model->objects) != 0) : ?>
				<div class="cl">
					<?php if($all > 2) : ?>
						<a href="#" id="my_object_all"><?php echo Yii::t('main','View All'); ?></a>
					<?php endif ?>
					<div class="my_objects">
						<?php foreach ($model->objects as $key => $object) : ?>
							<?php if($key == 3) : ?>
								</div><div class="my_objects_all">
							<?php endif ?>
							<div class="object all_object <?php echo ($key+1)%3==0 && $key!=0 ? 'third' : '';?>">
								<div class="object-price"><span><?php echo Yii::t("main", "from")?></span> <?php echo CHtml::encode($object->price); ?> €</div>
								<div class="object-img">
									<a href="<?php echo Yii::app()->createUrl('cataloge/view', array('id'=>$object->id)); ?>" title="<?php echo CHtml::encode($object->name); ?>">
										<?php if($object->mainImage){ ?>
											<?php echo $this->material_image($object->mainImage->id, $object->mainImage->name, '205', 'images/'.$object->user_id.'/'.$object->id); ?>
										<?php }else{ ?>
											<?php echo $this->material_image(0, 'noimage.gif', '205', ''); ?>
										<?php } ?>
									</a>
								</div>
								<h3 class="object-name">
									<a href="<?php echo Yii::app()->createUrl('cataloge/view', array('id'=>$object->id)); ?>" title="<?php echo CHtml::encode($object->name); ?>" class=""><?php echo CHtml::encode($object->name); ?></a>
								</h3>
								<?php if(isset($object->roomType)):?>
									<p><?php echo CHtml::encode($object->roomType->name); ?></p>
								<?php endif;?>
								<?php $address = $object->country->name.', '.$object->city->name.', '.$object->street.' '.$object->house .'/'.$object->apartment;?>
								<a href="#" class="onmap showMap" title="<?php echo $address?>"><?php echo $address?></a>
							</div>
						<?php endforeach; ?>
						
					</div>
				</div>
			<?php endif ?>
			<!-- END My Objects -->
			<div class="block_holder br5 cl">
				<div class="reviews">
					<h2>Reviews</h2>
				<!-- Comments -->
					<ul id="comment_list">
						<?php $this->renderPartial('_commentsList', array('comments'=>$comments)); ?>
					</ul>
					<!-- END Comments -->
				
				<!-- NEW Comment -->
					<div id="comment_new">
						<?php echo CHtml::form(); ?>
							<div class="post_form br5">
								<div class="av ">
									<div class="br5"><?php echo $this->material_image(Yii::app()->user->id, Yii::app()->user->getState('avatar'), '68', 'images/' . Yii::app()->user->id); ?></div>
									<span><?php echo Yii::app()->user->name; ?></span>
								</div>
								<?php echo CHtml::label('post a comment', 'textComment'); ?>
								<?php echo CHtml::textArea('textComment', '', array('class'=>'br5')); ?>
								<input type="hidden" name="profile_id" value="<?php echo $model->id; ?>" />
								<div class="cl"> 
									<span class="btn blue br5 fl">
										<?php echo CHtml::submitButton('Reply'); ?>
									</span>
								</div>
							</div>
						<?php echo CHtml::endForm();?>
					</div>
					<!-- END New Comment -->
				</div>
			</div>
		</div>
	</div>

	<!-- Right col -->
	<div id="right" class="br5">
		<div class="order_form">
			<form action="#" method="post">
				<div class="box">
					<div class="user_block">
						<div class="user_photo"> 
							<?php echo $this->material_image($model->id, $model->avatar, '187', 'images/' . $model->id); ?>
						</div>
						<div class="user_name"><?php echo CHtml::encode($model->full_name); ?></div>
						<?php if($model->id == Yii::app()->user->id) : ?>
							<div class="row"> <a href="#" class="btn red br5"><?php echo Yii::t('main','My messages') ?><span></span><i></i></a> </div>
						<?php else : ?>
							<div class="row">
								<a href="<?php echo Yii::app()->createUrl('users/sendMessage',array('id'=>$model->id)); ?>" class="btn red br5">
									<?php echo Yii::t('main','Contact me') ?><span></span><i></i>
								</a>
							</div>
						<?php endif ?>
					</div>
				</div>
			<!-- Bookmark -->
				<div class="box similar_holder">
					<h3>Bookmarks</h3>
					<div class="similar_box">
						<ul id="similar_objects">
							<?php foreach ($bookmarks as $key => $value) : ?>
								<li>
									<div class="title">
										<a href="<?php echo Yii::app()->createUrl('cataloge/view', array('id'=>$value->id)); ?>">
											<?php echo CHtml::encode($value->name); ?>
										</a>
									</div>
									<p>$<?php echo CHtml::encode($value->price); ?> per night</p>
									<p><?php echo CSelect::item($value->room_type_id, "RoomType","name"); ?></p>
									<div class="view br7">
										<a href="<?php echo Yii::app()->createUrl('cataloge/view', array('id'=>$value->id)); ?>">
											<?php if(isset($value->image_id)) : ?>
											<?php echo $this->material_image($value->mainImage->id, $value->mainImage->name, '184', 'images/'.$value->user_id.'/'.$value->id); ?>
											<?php endif; ?>
										</a>
									</div>
									<div class="rating"><span></span>4.7</div>
								</li>
							<?php endforeach; ?>
						</ul>
					</div>
				</div>
				<!-- END Bookmark -->
			</form>
		</div>
	</div>
</div>